my_list = [3, 1, 4, 1, 5, 9, 2, 6, 5]

if not my_list:  # 处理空列表
    max_value = min_value = None
else:
    max_value = min_value = my_list[0]
    for num in my_list:
        if num > max_value:
            max_value = num
        if num < min_value:
            min_value = num

print(f"最大值: {max_value}")
print(f"最小值: {min_value}")